import Taro, { Component } from '@tarojs/taro'
import { Image, View } from '@tarojs/components'
import './index.scss'
import classNames from 'classnames'
import { formatNumber } from "@/utils/utils"
import goldImg from '@/market/assets/icon/gold.png'

interface IProps {
  sale: any
  isSku: any
  origin: any
  saleSize: string
  className: string
}

export default class RecordList extends Component<IProps, {}> {
  props: any

  static options = {
    addGlobalClass: true
  }

  render() {
    const { sale, origin, isSku, saleSize=36, className } = this.props
    return (
      <View className={classNames('goods-price', className)}>
        <View className='sale-price'>
          <Image src={goldImg} className='sale-price__unit'/>
          <View className={`sale-price__num f-s-${saleSize}`}>{formatNumber(sale)}</View>
          {!!isSku && <View className='sale-price__text'>起</View>}
        </View>
        {!isSku && origin > sale &&  <View className='origin-price'>￥{formatNumber(origin)}</View>}
      </View>
    )
  }
}
